package cn.edu.ujn.park.service;

import cn.edu.ujn.park.dao.FeedBack;
import cn.edu.ujn.park.dao.MaintenanceRecord;
import cn.edu.ujn.park.dao.MaintenanceRecordMapper;
import cn.edu.ujn.util.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MaintenanceRecordServiceImpl implements IMaintenanceRecordService{
    @Autowired
    private MaintenanceRecordMapper maintenanceRecordMapper;
    @Override
    public int insert(MaintenanceRecord row) {
        return maintenanceRecordMapper.insert(row);
    }

    @Override
    public int updateByPrimaryKey(MaintenanceRecord row) {
        return maintenanceRecordMapper.updateByPrimaryKey(row);
    }

    @Override
    public List<MaintenanceRecord> selectAll() {
        return maintenanceRecordMapper.selectAll();
    }

    @Override
    public MaintenanceRecord selectByPrimaryKey(Integer maintenanceId) {
        return maintenanceRecordMapper.selectByPrimaryKey(maintenanceId);
    }

    @Override
    public int deleteByPrimaryKey(Integer maintenanceId) {
        return maintenanceRecordMapper.deleteByPrimaryKey(maintenanceId);
    }

    @Override
    public Page<MaintenanceRecord> selectAll1(MaintenanceRecord maintenanceRecord) {
        Page<MaintenanceRecord> page = new Page<>();
        List<MaintenanceRecord> maintenanceRecords = maintenanceRecordMapper.selectAll1(maintenanceRecord);
        page.setPage(maintenanceRecord.getStart());
        page.setRows(maintenanceRecords);
        page.setSize(maintenanceRecord.getRows());
        page.setTotal(maintenanceRecordMapper.selectCount());
        return page;
    }
}
